package org.vineatoum.view.utils;

import org.vineatoum.business.Exploitation;
import org.vineatoum.business.Ilot;
import org.vineatoum.business.Material;
import org.vineatoum.business.OenologicalProduct;
import org.vineatoum.business.Parcelle;
import org.vineatoum.business.Plantation;
import org.vineatoum.business.Cuve;
import org.vineatoum.business.state.Benne;
import org.vineatoum.business.state.Lie;
import org.vineatoum.business.state.Lot;
import org.vineatoum.business.state.Marc;
import org.vineatoum.business.state.Mout;
import org.vineatoum.business.state.Raisin;
import org.vineatoum.business.state.Recolte;
import org.vineatoum.business.state.Vin;
import org.vineatoum.model.abstraction.IVineaToumModel;
import org.vineatoum.view.ExploitationPanel;
import org.vineatoum.view.data.ParcelleDataPanel;
import org.vineatoum.view.data.RecolteDataPanel;
import org.vineatoum.view.stateView.BenneActionPanel;
import org.vineatoum.view.stateView.LieActionPanel;
import org.vineatoum.view.stateView.LotActionPanel;
import org.vineatoum.view.stateView.MarcActionPanel;
import org.vineatoum.view.stateView.MoutActionPanel;
import org.vineatoum.view.stateView.PlantationActionPanel;
import org.vineatoum.view.stateView.VinActionPanel;

public class BusinessPanelFactory {

	/*
	 * V1 Surement possible d'améliorer avec une hasmap et des chargement
	 * dynamique d'objet
	 */
	static public JPanelWrapped createBusinessPanel(IVineaToumModel model, Object template) {

		if (template instanceof Plantation) {
			return new PlantationActionPanel(model, (Plantation) template);
		} else if (template instanceof Exploitation) {
			return new ExploitationPanel(model, (Exploitation) template);
		} else if (template instanceof Ilot) {
			return null;
			// TODO
		} else if (template instanceof Material) {
			return null;
			// TODO
		} else if (template instanceof OenologicalProduct) {
			return null;
			// TODO
		} else if (template instanceof Parcelle) {
			return new ParcelleDataPanel(model, (Parcelle) template);
			// TODO
		} else if (template instanceof Cuve) {
			return null;
			// TODO
		} else if (template instanceof Benne) {
			return new BenneActionPanel(model, (Benne) template);
			// TODO
		} else if (template instanceof Lie) {
			return new LieActionPanel(model, (Lie) template);
			// TODO
		} else if (template instanceof Lot) {
			return new LotActionPanel(model, (Lot) template);
			// TODO
		} else if (template instanceof Marc) {
			return new MarcActionPanel(model, (Marc) template);
			// TODO
		} else if (template instanceof Mout) {
			return new MoutActionPanel(model, (Mout) template);
			// TODO
		} else if (template instanceof Raisin) {
			return null;
			// TODO
		} else if (template instanceof Recolte) {
			return new RecolteDataPanel(model, (Recolte) template);
			// TODO
		} else if (template instanceof Vin) {
			return new VinActionPanel(model, (Vin) template);
			// TODO
		} else {
			System.err.println("Business Panel Factory not recognize");
			return null;
		}
	}
}
